{% extends 'pc/person/index.html' %}
{% load static %}
{% block end %}
    <div class="person fl">

        <div class="clearfix">
            <div class="fl left_nav">
                <ul id="follow">
                    <li data-type="" class="active"><a href="javascript:;">关注</a></li>
                    <li data-type="" class=""><a href="javascript:;">粉丝</a></li>

                </ul>
            </div>
            <article class="fr">
                 <div class="blogs">
                     <div class="blogs_head" style="background: url({% static 'img/recommend.png' %})no-repeat 0 50%;">我的关注</div>
                     <div class="follow_main">
                         <ul class="clearfix">

                             {% for foo in count %}
                                    <li class="follow_item">
                                 <dl class="clearfix">
                                     <dt class="fl">
                                         <a target="_blank" title="" href="{% url 'user:author_detaile' foo.id %}">
                                            <img class="follow_item_img" width="50" height="50"style="background-color: #ccc;" alt="" src="{% if foo.user_imag %}
                                            {{ MEDIA_URL }}{{ foo.user_imag }}
                                            {% elif foo.user_image %}
                                            {{ foo.user_image }}
                                            {% else %}
                                            {% static 'img/pc-icon.png' %}
                                            {% endif %}">
                                         </a>
                                     </dt>
                                     <dd class="fl"style="text-align: left">
                                         <div class="follow_item_name">
                                            <a target="_blank" title="" alt="" href="{% url 'user:author_detaile' foo.id %}">{{ foo.username }}</a>
                                         </div>
                                         <div class="follow_item_info"style="text-align: left">
                                             <p>文章:{{ foo.article_set.count }}</p>
                                             <p>帖子:{{ foo.forum_set.count }}</p>
                                         </div>
                                     </dd>
{#                                     <dd class="fl follow_num">#}
{#                                         <div class="">#}
{#                                             <div>关注</div>#}
{#                                             <div>{{ floow.count }}</div>#}
{#                                         </div>#}
{#                                     </dd>#}
{#                                     <dd class="fl fans_num">#}
{#                                         <div class="">#}
{#                                             <div>粉丝</div>#}
{#                                             <div>{{ floow.count }}</div>#}
{#                                         </div>#}
{#                                     </dd>#}
                                     <dd class="fr follow_btn">
                                         <a href="javascript:;" type_id="{{ foo.id }}" class="guan">取消关注</a>
                                     </dd>
                                 </dl>
                             </li>
                             {% endfor %}
                         </ul>
                     </div>
                    <div class="follow_main" style="display: none">
                         <ul class="clearfix">
                             {% for foo in floow %}
                                    <li class="follow_item">
                                 <dl class="clearfix">
                                     <dt class="fl">
                                         <a target="_blank" title="" href="{% url 'user:author_detaile' foo.id %}">
                                            <img class="follow_item_img" width="50" height="50" alt="" style="" src="{% if foo.user_imag %}
                                            {{ MEDIA_URL }}{{ foo.user_imag }}
                                            {% elif foo.user_image %}
                                            {{ foo.user_image}}
                                            {% else %}
                                            {% static 'img/pc-icon.png' %}
                                            {% endif %}">
                                         </a>
                                     </dt>
                                     <dd class="fl" style="text-align: left">
                                         <div class="follow_item_name">
                                            <a target="_blank" title="" alt="" href="{% url 'user:author_detaile' foo.id %}">{{ foo.username }}</a>
                                         </div>
                                         <div class="follow_item_info"style="text-align: left">
                                            <p>文章:{{ foo.article_set.count }}</p>
                                             <p>帖子:{{ foo.forum_set.count }}</p>
                                         </div>
                                     </dd>

                                 </dl>
                             </li>
                             {% endfor %}
                         </ul>
                     </div>
                 </div>
            </article>
        </div>
    </div>
{% comment %} <aside class="fr">


        <div class="aside_pubnum">
            <div class="flex_justify">
               <div class="aside_my_div">
                   <p><img src="img/public.png" alt=""></p>
                   <p>写文章</p>
               </div>
                <div class="aside_my_div">
                    <p><img src="img/public.png" alt=""></p>
                    <p>提问</p>
                </div>
            </div>
        </div>
        <div class="aside_visit">
            <div>
                <div class="blogs_head" style="background: url(img/recommend.png)no-repeat 0 50%;">访客</div>
                <div>
                    <div class="visit_item">
                         <div class="visit_head img_cover"></div>
                        <div class="visit_info_text">
                            <p>狙击手</p>
                            <p class="vi_co">48分钟前</p>
                        </div>
                    </div>
                     <div class="visit_item">
                         <div class="visit_head img_cover"></div>
                        <div class="visit_info_text">
                            <p>狙击手</p>
                            <p class="vi_co">48分钟前</p>
                        </div>
                    </div>
                     <div class="visit_item">
                         <div class="visit_head img_cover"></div>
                        <div class="visit_info_text">
                            <p>狙击手</p>
                            <p class="vi_co">48分钟前</p>
                        </div>
                    </div>
                     <div class="visit_item">
                         <div class="visit_head img_cover"></div>
                        <div class="visit_info_text">
                            <p>狙击手</p>
                            <p class="vi_co">48分钟前</p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </aside>{% endcomment %}
{% endblock %}
{% block js %}
    <script src="{% static 'js/promise.min.js' %}"></script>
    <script src="{% static 'js/sweetalert.min.js' %}"></script>
    <script>
    $(function () {
        $('.guan').on('click',function () {
            var n = $(this).attr('type_id')
            var self = $(this)
             $.ajax({
                url:"/person/Guan/",
                type:'POST',
                data:{follow:n,user:'{{ request.user.id }}'},
                success:function (data) {
                    if(data.data==200){
                          swal({
                              text: "已取消!",
                              icon: "success",
                            }).then(function () {
                               self.parents('li').remove()
                           })
                    }else {
                          swal({
                              text: "取消失败,稍后重试!",
                              icon: "error",
                            })
                    }



                }
            })
        })
        $('#follow li').on('click',function () {
               $('.follow_main').siblings('.blogs_head').text('我的'+$(this).text())
            $(this).addClass('active').siblings().removeClass('active')
            var index= $(this).index()
            $('.follow_main').eq(index).show().siblings('.follow_main').hide()
        })

    })
    </script>
{% endblock %}